/**
 * Created by aesop on 2015/9/26.
 */

requirejs.config({
  paths:{
    "React":"../bower_components/react/react.min"
  }
})

var launchContainer = document.getElementById('launchContainer');
var container = document.getElementById("container");
var stackContainer = document.getElementById('stackContainer');

requirejs(['React','vendor/launch','vendor/ui'], function(React,Launch,uiComponents){
  //React.initializeTouchEvents();


  setTimeout(function(){
    launchContainer.setAttribute('style','visibility:hidden;opacity:0;');
      setTimeout(function(){
       launchContainer.innerHTML = '';
      },1000);
  } ,  0);

  var NavigatorBar = uiComponents.container.nav;
  var Stacks = uiComponents.container.stacks;




  var TableView2 = uiComponents.tableView.tableView2;
  var PicNav = uiComponents.picNav.PicNav;
  var Ad = uiComponents.ad.Ad;
  var UCenter = uiComponents.uCenter.UCenter;

  var data = [{readCount:12,commentCount:1,likeCount:12,author:"东写西读",time:"2015-8-31 15:22:18", title:"互联网时代",img:"http://ww2.sinaimg.cn/bmiddle/b2317b07jw1ewte788g7zj218g0p0gru.jpg"}];
  for(var i =0 ;i < 3; i++){
    data= data.concat(data);
  }

  //var list =   {title:"列表",content:<TableView2 data={data.concat(data)}/>,key:"sss"};
  var list = [{img:"http://img002.qufenqi.com/products/d4/51/d45127bb06ceff446311a0e17d9d5659.png",text:'资讯'}];
  var src = 'http://ww4.sinaimg.cn/bmiddle/718878b5gw1ewtozl7oj5j20go079dgk.jpg'
  list=list.concat(list).concat(list).concat(list);
  var obj={
    "nameList":[{img:"images/favicon.ico",
      title:"首页",name:"a",key:'a'},{img:"images/favicon.ico",
      title:"分类",name:"b",key:'b'},{img:"images/favicon.ico",
      title:"续写",name:"c",key:'c'},{img:"images/favicon.ico",
      title:"个人中心",name:"d",key:'d'}],
    "contentList":{
      "a":[<Ad src={src} />,<PicNav data={list}/>,<TableView2 data={data}/>],
      "d":[<UCenter />]
    }
  };


  React.render(<NavigatorBar {...obj}/>,container )
  //React.render(<Stacks {...list}/>,stackContainer)

  //var pa = document.createElement("div");
  //var list1 = {title:"bbb",content:<div>防守对方</div>,key:"sdds"}
  //React.render(<Stacks {...list1}/>,pa );
  //
  //document.body.appendChild(pa);

});